#include "MessageBoxProxy.h"
#include "DIVA_Application.h"
#include <QMessageBox>

MessageBoxProxy* MessageBoxProxy::instance = NULL;
MessageBoxProxy::MessageBoxProxy()
	: QObject()
{
	QMessageBox* msgBox = DIVA_Application::getInstance()->getMessageBox();
	connect(this, SIGNAL(showMessageBox()),msgBox,SLOT(exec()), Qt::BlockingQueuedConnection);
}

MessageBoxProxy::~MessageBoxProxy()
{
}

MessageBoxProxy* MessageBoxProxy::getInstance()
{
	if ( instance == NULL ){
		instance = new MessageBoxProxy();
	}

	return instance;
}

void MessageBoxProxy::setText( QString msg )
{
	QMessageBox* msgBox = DIVA_Application::getInstance()->getMessageBox();
	msgBox->setText(msg);
}

void MessageBoxProxy::exec()
{
	emit showMessageBox();
}
